<?php

class a{
    public $name;
    public $sex;
}

$a = new a();
$a->sex = "男";
$a->name = "王永清";
$b = $a;

$b->sex = "女";
echo  $a->sex;